<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: ViewModels::Extensions::ModelReader::FilteredDelegationInstaller
  
    &mdash; Documentation by YARD 0.8.3
  
</title>

  <link rel="stylesheet" href="../../../css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="../../../css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../../../';
  framesUrl = "../../../frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="../../../_index.html">Index (F)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../../../ViewModels.html" title="ViewModels (module)">ViewModels</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Extensions.html" title="ViewModels::Extensions (module)">Extensions</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../ModelReader.html" title="ViewModels::Extensions::ModelReader (module)">ModelReader</a></span></span>
     &raquo; 
    <span class="title">FilteredDelegationInstaller</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../../../class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="../../../method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="../../../file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: ViewModels::Extensions::ModelReader::FilteredDelegationInstaller
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">ViewModels::Extensions::ModelReader::FilteredDelegationInstaller</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">lib/view_models/extensions/model_reader.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>The filtered delegation installer installs delegators on the target that
are filtered.</p>


  </div>
</div>
<div class="tags">
  

</div>



  <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#attributes-instance_method" title="#attributes (instance method)">- (Object) <strong>attributes</strong> </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The attributes target, attributes, filters.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#filters-instance_method" title="#filters (instance method)">- (Object) <strong>filters</strong> </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The attributes target, attributes, filters.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#target-instance_method" title="#target (instance method)">- (Object) <strong>target</strong> </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The attributes target, attributes, filters.</p>
</div></span>
  
</li>

    
  </ul>




  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#filtered_left_parentheses-instance_method" title="#filtered_left_parentheses (instance method)">- (Object) <strong>filtered_left_parentheses</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Combines left parentheses and filters.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (FilteredDelegationInstaller) <strong>initialize</strong>(target, options) </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Initialize a new filtered delegation.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#install-instance_method" title="#install (instance method)">- (Object) <strong>install</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Install a reader for each attribute.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#install_reader-instance_method" title="#install_reader (instance method)">- (Object) <strong>install_reader</strong>(attribute) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Install a reader for the given name with the given filters.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#left_parentheses-instance_method" title="#left_parentheses (instance method)">- (Object) <strong>left_parentheses</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Generates an array of left parentheses with length &lt;amount of
filters&gt;.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#reader_definition_for-instance_method" title="#reader_definition_for (instance method)">- (Object) <strong>reader_definition_for</strong>(attribute) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Defines a reader for the given model attribute and filtering through the
given filters.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#right_parentheses-instance_method" title="#right_parentheses (instance method)">- (Object) <strong>right_parentheses</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Generates the needed amount of parentheses to match the left parentheses.</p>
</div></span>
  
</li>

      
    </ul>
  

<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="ViewModels::Extensions::ModelReader::FilteredDelegationInstaller (class)">FilteredDelegationInstaller</a></span></tt>) <strong>initialize</strong>(target, options) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Initialize a new filtered delegation</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>target</span>
      
      
        <span class='type'>(<tt>ViewModel</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>the target to install the filtered delegation in</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>options</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Options.html" title="ViewModels::Extensions::ModelReader::Options (class)">ModelReader::Options</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The options for the filtered delegation</p>
</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


76
77
78</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 76</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_target'>target</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span>
  <span class='ivar'>@target</span><span class='comma'>,</span> <span class='ivar'>@attributes</span><span class='comma'>,</span> <span class='ivar'>@filters</span> <span class='op'>=</span> <span class='id identifier rubyid_target'>target</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_options'>options</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>

  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id=""></span>
      <div class="method_details first">
  <h3 class="signature first" id="attributes-instance_method">
  
    - (<tt>Object</tt>) <strong>attributes</strong>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>The attributes target, attributes, filters</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


70
71
72</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 70</span>

<span class='kw'>def</span> <span class='id identifier rubyid_attributes'>attributes</span>
  <span class='ivar'>@attributes</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="filters-instance_method">
  
    - (<tt>Object</tt>) <strong>filters</strong>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>The attributes target, attributes, filters</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


70
71
72</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 70</span>

<span class='kw'>def</span> <span class='id identifier rubyid_filters'>filters</span>
  <span class='ivar'>@filters</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="target-instance_method">
  
    - (<tt>Object</tt>) <strong>target</strong>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>The attributes target, attributes, filters</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


70
71
72</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 70</span>

<span class='kw'>def</span> <span class='id identifier rubyid_target'>target</span>
  <span class='ivar'>@target</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="filtered_left_parentheses-instance_method">
  
    - (<tt>Object</tt>) <strong>filtered_left_parentheses</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Combines left parentheses and filters.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


106
107
108</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 106</span>

<span class='kw'>def</span> <span class='id identifier rubyid_filtered_left_parentheses'>filtered_left_parentheses</span>
  <span class='id identifier rubyid_filters'>filters</span><span class='period'>.</span><span class='id identifier rubyid_zip'>zip</span><span class='lparen'>(</span><span class='id identifier rubyid_left_parentheses'>left_parentheses</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="install-instance_method">
  
    - (<tt>Object</tt>) <strong>install</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Install a reader for each attribute</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


82
83
84</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 82</span>

<span class='kw'>def</span> <span class='id identifier rubyid_install'>install</span>
  <span class='id identifier rubyid_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_attribute'>attribute</span><span class='op'>|</span> <span class='id identifier rubyid_install_reader'>install_reader</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="install_reader-instance_method">
  
    - (<tt>Object</tt>) <strong>install_reader</strong>(attribute) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Install a reader for the given name with the given filters.</p>


  </div>
</div>
<div class="tags">
  
  <div class="examples">
    <p class="tag_title">Examples:</p>
    
      
        <p class="example_title"><div class='inline'>
<p>Installs a reader for model.attribute</p>
</div></p>
      
      <pre class="example code"><span class='id identifier rubyid_install_reader'>install_reader</span> <span class='symbol'>:attribute</span></pre>
    
  </div>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


91
92
93</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 91</span>

<span class='kw'>def</span> <span class='id identifier rubyid_install_reader'>install_reader</span> <span class='id identifier rubyid_attribute'>attribute</span>
  <span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='id identifier rubyid_reader_definition_for'>reader_definition_for</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="left_parentheses-instance_method">
  
    - (<tt>Object</tt>) <strong>left_parentheses</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Generates an array of left parentheses with length &lt;amount of
filters&gt;</p>


  </div>
</div>
<div class="tags">
  
  <div class="examples">
    <p class="tag_title">Examples:</p>
    
      
        <p class="example_title"><div class='inline'>
<p>for 4 Filters</p>
</div></p>
      
      <pre class="example code"><span class='id identifier rubyid_left_parentheses'>left_parentheses</span> <span class='comment'># =&gt; ['(', '(', '(', '(']</span></pre>
    
  </div>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


121
122
123</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 121</span>

<span class='kw'>def</span> <span class='id identifier rubyid_left_parentheses'>left_parentheses</span>
  <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>(</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>*</span> <span class='id identifier rubyid_filters'>filters</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="reader_definition_for-instance_method">
  
    - (<tt>Object</tt>) <strong>reader_definition_for</strong>(attribute) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong>
    <div class='inline'>
<p>The filters are applied from last to first element.</p>
</div>
  </div>


<p>Defines a reader for the given model attribute and filtering through the
given filters.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


100
101
102</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 100</span>

<span class='kw'>def</span> <span class='id identifier rubyid_reader_definition_for'>reader_definition_for</span> <span class='id identifier rubyid_attribute'>attribute</span>
  <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>def </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbrace'>}</span><span class='tstring_content'>; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_filtered_left_parentheses'>filtered_left_parentheses</span><span class='rbrace'>}</span><span class='tstring_content'>model.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbrace'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_right_parentheses'>right_parentheses</span><span class='rbrace'>}</span><span class='tstring_content'>; end</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="right_parentheses-instance_method">
  
    - (<tt>Object</tt>) <strong>right_parentheses</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Generates the needed amount of parentheses to match the left parentheses.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


112
113
114</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 112</span>

<span class='kw'>def</span> <span class='id identifier rubyid_right_parentheses'>right_parentheses</span>
  <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>)</span><span class='tstring_end'>'</span></span> <span class='op'>*</span> <span class='id identifier rubyid_filters'>filters</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Tue Oct 16 23:27:35 2012 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.3 (ruby-1.9.3).
</div>

  </body>
</html>